package week8;

import java.util.Scanner;
import java.util.Set;
import java.util.TreeSet;

public class Danci {
	public static void main(String[] args){
	Set<String> words=new TreeSet();
	Scanner sc=new Scanner(System.in);
	int i=0;
	boolean flag=true;
	while(flag){
		String str=sc.next();
		if(str.equals("!!!!!")){
			flag=false;
		}
		words.add(str);
	}
	System.out.println(words.size());
	for(String s:words){
		System.out.println(s);
		i++;
		if(i>9)
			break;
	}
	}
}
